/*
 * Copyright (c) 2022, tyustli
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-02-08     tyustli      first implementation
 */

#include <stdio.h>

/* 改变函数参数需要传入指针 */
static void swap_two_num(int *a, int *b)
{
    int temp;

    temp = *a;
    *a = *b;
    *b = temp;
}

int main(int argc, char **argv)
{
    int a = 10;
    int b = 20;
    printf("before: a is %d, b is %d\r\n", a, b);

    swap_two_num(&a, &b);

    printf("after:  a is %d, b is %d\r\n", a, b);

    return 0;
}
/**
 * 编译：make
 * 运行：./out
 * 结果：
 * before: a is 10, b is 20
 * after:  a is 20, b is 10
 * 清除编译结果：make clean
 *
 */
/******************** end of file **********************/
